<% if sub_menu %>
<script type="text/javascript">
jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
  .addClass('wp-has-current-submenu')
  .find('a[href$="<%= sub_menu %>"]')
  .addClass('current')
  .parent()
  .addClass('current');
</script>
<% endif %>

<!-- system notices -->
<div id="mailpoet_notice_system" class="mailpoet_notice" style="display:none;"></div>

<!-- handlebars templates -->
<% block templates %><% endblock %>

<!-- main container -->
<div class="wrap">
  <!-- notices -->
  <div id="mailpoet_notice_error" class="mailpoet_notice" style="display:none;"></div>
  <div id="mailpoet_notice_success" class="mailpoet_notice" style="display:none;"></div>

  <!-- title block -->
  <% block title %><% endblock %>
  <!-- content block -->
  <% block content %><% endblock %>
</div>

<!-- stylesheets -->
<%= stylesheet(
  'admin.css'
)%>

<%= do_action('mailpoet_styles_admin_after') %>

<!-- rtl specific stylesheet -->
<% if is_rtl %>
  <%= stylesheet('rtl.css') %>
<% endif %>

<% block after_css %><% endblock %>

<script type="text/javascript">
  var mailpoet_date_format = "<%= wp_datetime_format()|escape('js') %>";
  var mailpoet_time_format = "<%= wp_time_format()|escape('js') %>";
  var mailpoet_version = "<%= mailpoet_version() %>";
  var mailpoet_premium_version = <%= json_encode(mailpoet_premium_version()) %>;
  var mailpoet_analytics_enabled = <%= is_analytics_enabled() | json_encode %>;
  var mailpoet_analytics_data = <%= json_encode(get_analytics_data()) %>;
</script>

<!-- javascripts -->
<%= javascript(
  'vendor.js',
  'mailpoet.js'
)%>

<%= localize({
  'ajaxFailedErrorMessage': __('An error has happened while performing a request, the server has responded with response code %d'),
}) %>
<% block translations %><% endblock %>

<% block after_translations %><% endblock %>

<%= javascript(
  'admin_vendor.js'
)%>

<%= do_action('mailpoet_scripts_admin_before') %>

<%= javascript(
  'admin.js'
)%>

<%= javascript('lib/analytics.js') %>

<script type="text/javascript">
  if(window['HS'] !== undefined) {
    // HelpScout Beacon: Configuration
    HS.beacon.config({
      icon: 'message',
      zIndex: 50000,
      instructions: "<%= __('Want to give feedback to the MailPoet team? Contact us here. Please provide as much information as possible!') %>",
      showContactFields: true
    });

    // HelpScout Beacon: Custom information
    HS.beacon.ready(function() {
      HS.beacon.identify(
        <%= json_encode(get_helpscout_data()) %>
      );
    });
  }
</script>

<% block after_javascript %><% endblock %>
